package com.efesco.service.archives;

import com.bstek.dorado.data.*;
import com.bstek.dorado.data.db.SqlDataset;
import com.bstek.dorado.common.*;
import com.efesco.common.CommUtil;

/**
 * M_archives_dataset_change_queryListener
 */
public class M_archives_dataset_change_queryListener extends AbstractDatasetListener {
  public boolean beforeLoadData(Dataset dataset)
     throws Exception {

		SqlDataset ds = (SqlDataset) dataset;
		String sql = ds.getSql();
		sql = CommUtil.getRoleSql(sql, "sc");
		sql += CommUtil.setConditionSQL(ds);
		if(ds.parameters().getString("orderby")!=null)
		sql =sql.trim()+" "+ds.parameters().getString("orderby");
		//System.out.println(sql);
		ds.setSql(sql);
    return true;
  }

}
